Skip to content

Add links to and from deployments #1921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 14, 2025
Merged

Add links to and from deployments #1921

merged 4 commits into from
Apr 14, 2025

Conversation

nicktrn
Copy link
Collaborator

@nicktrn nicktrn commented Apr 13, 2025

You can now click on tasks in the Deployments side panel, which will take you to the Runs page filtered by the task name:
image

The Detail tab on a run now also has a link back to the specific deployment:
image

Summary by CodeRabbit

  • New Features
    • Added version-based pagination to track deployments relative to a selected version.
    • Enhanced navigation with interactive links on deployment and run views, allowing users to easily access detailed deployment pages.
    • Improved URL handling that dynamically updates the selected deployment, ensuring a smoother and more intuitive user experience.
    • Introduced a navigable link for deployment versions with additional context in tooltips.

Copy link
Contributor

coderabbitai bot commented Apr 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request adds a new method to calculate the deployment page based on a provided version. The findPageForVersion method in the presenter retrieves necessary project and environment data and executes a SQL query to determine the proper page number. Additionally, route files are updated to handle an optional version query parameter, adjust navigation to a selected deployment, and generate links using new path builder functions. A tooltip is also implemented for deployment version links, and a comment in a separate route file is updated.

Changes

File(s) Change Summary
apps/webapp/app/presenters/v3/DeploymentListPresenter.server.ts Adds new public async method findPageForVersion to compute the deployment page based on a version and returns the page number after executing a raw SQL query.
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/deployments.$deploymentParam/route.tsx
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/deployments/route.tsx
Enhances deployments routes by importing v3RunsPath for generating task URLs, adding an optional version parameter to the loader, using findPageForVersion for page calculation, and implementing navigation based on a selected deployment.
apps/webapp/app/routes/projects.v3.$projectRef.deployments.$deploymentParam.ts Updates a comment to indicate that redirection is now toward the project's deployments page.
apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam/runs.$runParam.spans.$spanParam/route.tsx Introduces an import for v3DeploymentVersionPath and modifies the version display to use a SimpleTooltip with a linked TextLink pointing to the deployment version URL.
apps/webapp/app/utils/pathBuilder.ts Adds a new function v3DeploymentVersionPath that returns a URL string with the version query parameter appended to the deployment path.

Possibly related PRs

  • Run Engine 2.0 (alpha) #1575: The changes in the main PR, specifically the addition of the findPageForVersion method in the DeploymentListPresenter class, are related to the modifications in the retrieved PR, which involve enhancements to the handling of deployments and worker instances, including the introduction of new methods and properties that may interact with deployment tracking. Both PRs focus on improving functionality related to deployments, indicating a strong connection at the code level.

Suggested reviewers

  • ericallam

Poem

I'm a hopping rabbit with a love for code,
New routes and methods lighten my load.
SQL queries and version checks in a line,
Each change precise, robust by design.
I hop with joy, through code fields I bound,
Celebrating updates with a happy, bouncy sound!

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3f7dcc and 70be177.

📒 Files selected for processing (1)
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (2 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/webapp/app/presenters/v3/DeploymentListPresenter.server.ts (1)

171-218: Well-implemented pagination logic for finding deployments by version

The new findPageForVersion method provides a clean way to determine which page contains a specific deployment version. The SQL query efficiently compares version strings as integer arrays, which is appropriate for semantic versioning.

There's a minor type issue in the SQL query return type. Consider using lowercase primitive types for consistency:

-    const deploymentsSinceVersion = await this.#prismaClient.$queryRaw<{ count: BigInt }[]>`
+    const deploymentsSinceVersion = await this.#prismaClient.$queryRaw<{ count: bigint }[]>`
🧰 Tools
🪛 Biome (1.9.4)

[error] 208-208: Don't use 'BigInt' as a type.

Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead

(lint/complexity/noBannedTypes)

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsx (2)

74-95: Consider improving error handling for version-based page finding

The logic to find a page based on version is well-implemented, but if an error occurs during the process, the code only logs to the console and then continues execution with the default page.

Consider adding a more user-friendly fallback, such as:

-    } catch (error) {
-      console.error("Error finding page for version", error);
-      // Carry on, we'll just show the selected page
-    }
+    } catch (error) {
+      console.error("Error finding page for version", error);
+      // Return to first page as fallback
+      page = 1;
+    }

130-141: Well-implemented automatic navigation to deployment details

The useEffect hook properly handles the use case of navigating to the selected deployment when a version parameter is provided. It correctly:

  1. Checks if there's a selected deployment but no deployment parameter
  2. Removes the version parameter from the URL
  3. Updates the URL with the deployment shortCode

Consider adding a dependency on navigate to the dependency array to silence any potential React hooks exhaustive-deps warnings:

-  }, [selectedDeployment, deploymentParam, location.search]);
+  }, [selectedDeployment, deploymentParam, location.search, navigate, location.pathname, currentPage]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d920d5 and b3f7dcc.

📒 Files selected for processing (6)
  • apps/webapp/app/presenters/v3/DeploymentListPresenter.server.ts (1 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments.$deploymentParam/route.tsx (2 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsx (5 hunks)
  • apps/webapp/app/routes/projects.v3.$projectRef.deployments.$deploymentParam.ts (1 hunks)
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (2 hunks)
  • apps/webapp/app/utils/pathBuilder.ts (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
apps/webapp/app/presenters/v3/DeploymentListPresenter.server.ts

[error] 208-208: Don't use 'BigInt' as a type.

Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead

(lint/complexity/noBannedTypes)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: units / 🧪 Unit Tests
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (11)
apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (2)

60-63: Good addition of the v3DeploymentVersionPath import

This import supports the new feature for navigating from a run to its corresponding deployment version.


531-546: Well-implemented version navigation with tooltip

This change replaces the plain text version display with a clickable link that navigates to the deployment. The tooltip clearly communicates the action to users.

apps/webapp/app/routes/projects.v3.$projectRef.deployments.$deploymentParam.ts (1)

36-36: Correct comment update

The comment now accurately reflects that the redirection is to the project's deployments page, which aligns with the actual behavior of the code.

apps/webapp/app/utils/pathBuilder.ts (1)

398-405: Good implementation of the deployment version path builder

The new function properly constructs a URL to the deployments page with the version as a query parameter, following the same pattern as other path builder functions in this file.

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments.$deploymentParam/route.tsx (2)

31-31: Good addition of v3RunsPath import

This import supports the new feature to make tasks in the deployment details clickable.


234-247: Well-implemented clickable task rows

This change makes tasks in the deployment panel clickable by:

  1. Creating a path to the runs filtered by task
  2. Adding the to prop to both cells in the row

Users can now easily navigate from deployments to related runs filtered by task, improving the application's navigation experience.

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsx (5)

2-2: Added required imports for new navigation functionality

The import additions are necessary for the new deployment link navigation functionality.


55-55: Added useEffect import for deployment navigation

This import is correctly added to support the new automatic navigation to deployment details.


65-68: Added version parameter to search params schema

The schema correctly defines the optional version parameter which enables linking directly to specific deployments.


106-111: Good implementation of selectedDeployment finding

The code correctly identifies the deployment corresponding to the requested version, making it available to the UI component.


125-126: Updated loader data destructuring to include selectedDeployment

Correctly extracts the new selectedDeployment property from the loader data.

Copy link

changeset-bot bot commented Apr 14, 2025

⚠️ No Changeset found

Latest commit: 70be177

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nicktrn nicktrn merged commit 5f4c607 into main Apr 14, 2025
6 of 11 checks passed
@nicktrn nicktrn deleted the feat/deployment-links branch April 14, 2025 13:43
matt-aitken pushed a commit that referenced this pull request Apr 16, 2025
* link from deployments tasks to filtered runs view

* jump to deployment

* don't add version links for dev (yet)
matt-aitken added a commit that referenced this pull request Apr 17, 2025
* WIP on secret env vars

* Editing individual env var values is working

* Sort the env vars by the key

* Deleting values

* Allowing setting secret env vars

* Added medium switch style

* Many style changes to the env var form

* “Copy text” -> “Copy”

* Draw a divider between hidden buttons

* Env var tweaks

* Don’t show Dev:you anymore

* Grouping the same env var keys together

* Styles improved

* Improved styling of edit panel

* Fix bun detection, dev flushing, and init command (#1914)

* update nypm to support text-based bun lockfiles

* add nypm changeset

* handle dev flushing failures gracefully

* fix path normalization for init.ts

* add changesets

* chore: remove pre.json after exiting pre mode

* init command to install v4-beta packages

* Revert "chore: remove pre.json after exiting pre mode"

This reverts commit f5694fd.

* make init default to cli version for all packages

* Release 4.0.0-v4-beta.1 (#1916)

* chore: Update version for release (v4-beta)

* Release 4.0.0-v4-beta.1

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com>

* Both run engines will only lock to versions they can handle (#1922)

* run engine v1 will only lock to v1 deployments

* run engine v2 will only lock to managed v2 deployments

* test: create background worker and deployment with correct engine version

* Add links to and from deployments (#1921)

* link from deployments tasks to filtered runs view

* jump to deployment

* don't add version links for dev (yet)

* Fix current worker deployment getter (#1924)

* only return last v1 deployment in the shared queue consumer

* be explicit about only returning managed deployments

* Add a docs page for the human-in-the-loop example project (#1919)

* Add a docs page for the human-in-the-loop example project

* Order guides, example projects and example tasks alphabetically in the docs list

* Managed run controller revamp (#1927)

* update nypm to support text-based bun lockfiles

* fix retry spans

* only download debug logs if admin

* add nypm changeset

* pull out env override logic

* use runner env gather helper

* handle dev flushing failures gracefully

* fix path normalization for init.ts

* add logger

* add execution heartbeat service

* add snapshot poller service

* fix poller

* add changesets

* create socket in constructor

* enable strictPropertyInitialization

* deprecate dequeue from version

* start is not async

* dependency injection in prep for tests

* add warm start count to all controller logs

* add restore count

* pull out run execution logic

* temp disable pre

* add a controller log when starting an execution

* refactor execution and squash some bugs

* cleanup completed docker containers by default

* execution fixes and logging improvements

* don't throw afet abort cleanup

* poller should use private interval

* rename heartbeat service file

* rename HeartbeatService to IntervalService

* restore old heartbeat service but deprecate it

* use the new interval service everywhere

* Revert "temp disable pre"

This reverts commit e03f417.

* add changeset

* replace all run engine find uniques with find first

* Release 4.0.0-v4-beta.2 (#1928)

* chore: Update version for release (v4-beta)

* Release 4.0.0-v4-beta.2

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com>

* Remove batch ID carryover for non-batch waits (#1930)

* add failing test case

* do not carry over previous batch id when blocking with waitpoint

* delete irrelevant test

* Delete project (#1913)

* Delete project

- Don’t schedule tasks if the project is deleted
- Delete queues from the master queues
- Add the old delete project UI back in

* Mark the project as deleted last

* Fix for overriding local variable

* Added a todo for deleting env queues

* Remove todo

* Improve usage flushing (#1931)

* add flush to global usage api

* enable controller debug logs

* initialize usage manager after env overrides

* add previous run id to more debug logs

* add changeset

* For secret env vars, don’t return the value

* Added a new env var repository function for getting secrets with redactions

* Test task for env vars

* Delete heartbeat file, merge mess up

---------

Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Saadi Myftija <saadi.myftija@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants